<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    </meta>
    <title>ajax_demo</title>
    <style>
        div {
            border: 1px solid black;
            margin-top: 2px;
        }

    </style>
    <script>
        function ajaxFunc() {
            var xhr;
            if (window.ActiveXObject) { 
                xhr = new ActiveXObject("Microsoft.XMLHTTP");
            } else { 
                xhr = new XMLHttpRequest();
            }
            xhr.open("GET", "data.html", true);
            xhr.send();
            xhr.onreadystatechange = function () {
                if (xhr.readyState == 4 && xhr.status == 200) {
                    document.getElementById("myDiv2").innerHTML = xhr.responseText;
                }
            }
        }
    </script>
</head>

<body>
    <button onclick="ajaxFunc()">请求ajax 获取数据</button>
    <div id="myDiv1" style="width: 200px; height: 200px; "></div>
    <div id="myDiv2" style="width: 200px; height: 200px;"></div>
    <div>aaaaaadddddd</div>
</body>

</html>